﻿using System.Threading;
using System.Threading.Tasks;

namespace Puppy.Scheduler.Processors
{
    /// <summary>
    /// 处理器接口
    /// </summary>
    public interface IProcessor
    {
        /// <summary>
        /// 任务处理
        /// </summary>
        /// <param name="context">任务上下文</param>
        /// <param name="cancellationToken">用于取消异步操作的可选令牌</param>
        /// <returns>处理结果，Result有长度限制，超长会被裁剪，不允许返回空值</returns>
        Task<ProcessResult> ProcessAsync(TaskContext context, CancellationToken cancellationToken = default);
    }
}
